﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _01_运算符
{
    public class Point
    {
        public int X { get; set; }
        public int Y { get; set; }
        public Point(Point p)
        {
            this.X = p.X;
            this.Y = p.Y;
        }
        public Point(int x,int y)
        {
            this.X = x;
            this.Y = y;
        }
        public static Point operator+(Point lperosn, Point rperson)//operator：重载
        {
            Point result = new Point(lperosn);
            result.X += rperson.X;
            result.Y += rperson.Y;
            return  result;
 
        }
        public static Point operator*(int num, Point rperson)//operator：重载
        {
            
            rperson.X += rperson.X*num;
            rperson.Y += rperson.Y*num;
            return rperson;

        }
        public static Point operator *(Point rperson,int num)//operator：重载
        {

            rperson.X += rperson.X * num;
            rperson.Y += rperson.Y * num;
            return rperson;

        }
        public override string ToString()
        {
            return ("Id:" + this.X + "Name:" + this.Y);
        }
    }
}
